package com.example.springbootmbyatisautogenerate.plugin;

/**
 * @author liguang
 * @date 2022/9/5 10:13
 */
public class PageUtil {

    private static final ThreadLocal<PageInfo> PAGE_INFO_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 分页帮助工具类方法
     * @param currPage 当前页
     * @param pageSize 每页大小
     */
    public static void start(int currPage, int pageSize){
        PageInfo pageInfo = new PageInfo(currPage, pageSize);
        PAGE_INFO_THREAD_LOCAL.set(pageInfo);
    }

    public static PageInfo getPageInfo(){
        return PAGE_INFO_THREAD_LOCAL.get();
    }

    public static void removePageInfo(){
        PAGE_INFO_THREAD_LOCAL.remove();
    }

}
